#!/usr/bin/env bash -e

# Note: use lowercase names for the Docker images
DOCKER_IMAGE="azureiotpcs/pcs-auth-dotnet"

APP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && cd .. && pwd )/"
source "$APP_HOME/scripts/.functions.sh"

run_container() {
    check_dependency_docker

    $APP_HOME/scripts/env-vars-check

    # Some settings are used to connect to an external dependency, e.g. Azure Active Directory
    # Depending on which settings and which dependencies are needed, edit the list of variables
    echo "Starting Auth ..."
    docker run -it -p 9001:9001 \
        -e PCS_KEYVAULT_NAME \
        -e PCS_AAD_APPID \
        -e PCS_AAD_APPSECRET \
        "$DOCKER_IMAGE:testing"
}

run_container

set +e
